<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <ui:composition template="layout.xhtml">

        <ui:define name="title">
            Pesquisar Origem
            </ui:define>
            
        <ui:define name="content">
            <h:form id="pesquisarOrigemForm">
                <p:messages id="pesquisarOrigemMessages" autoUpdate="true" />
                <div class="row">
                    <div class="column12">
                  <div class="actions">
                    <div id="buttons">
                        <p:button value="Cadastrar" outcome="criarOrigem.xhtml"
                                  icon="ui-icon-plus" styleClass="ui-priority-primary">
                        </p:button>
                    </div>
                </div> 
            

                        <p:fieldset legend="Filtros" id="dadosFieldset">
                            <f:validateBean disabled="true">
                                <div class="row">
                                    <div class="column2">
                                        <p:outputLabel value="Nome" for="nomeInputText" />
                                    </div>
                                    <div class="column8">
                                        <p:inputText id="nomeInputText" value="#{ managerPesquisarOrigem.origemPesquisar.nome }"/>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="column2">
                                        <p:outputLabel value="Descrição" for="descricaoInputText" />
                                    </div>
                                    <div class="column8">
                                        <p:inputText id="descricaoInputText" value="#{ managerPesquisarOrigem.origemPesquisar.descricao }"/>
                                    </div>
                                </div>
                            </f:validateBean>
                        </p:fieldset>

                        <div class="command">
                            <p:commandButton
                                id="pesquisarcommandButton" value="Pesquisar" icon="ui-icon-search"
                                styleClass="ui-priority-primary"
                                update="@form" actionListener="#{ managerPesquisarOrigem.pesquisar() }" />
                            <p:commandButton value="Limpar" icon="ui-icon-close" update="@form" actionListener="#{ managerPesquisarOrigem.limpar() }" />
                        </div>

                        <p:dataTable id="origensDataTable" var="origem" value="#{ managerPesquisarOrigem.origens }"
                                     rows="10" paginator="true" paginatorPosition="bottom" emptyMessage="Nenhuma origem encontrada">

                            <p:column width="5%" headerText="Opções">
                                <div class="options1">

                                    <p:button
                                        title="Visualizar" href="visualizarOrigem.xhtml?origemId=#{ origem.id }"
                                        icon="ui-icon-search"/>

                                </div>
                            </p:column>

                            <p:column headerText="Nome" width="92%">
                                <h:outputText value="#{ origem.nome }" />
                            </p:column>
                        </p:dataTable>
                    </div>
                </div>

            </h:form>
            
            <script>
                $(document).ready(function() {
                    setSelectedMenu('#imovel');
                });
            </script>            
            
        </ui:define>
    </ui:composition>

</html>